﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ControlLibary
{
    [Serializable]
    public class DBColor
    {
        public int R { get; private set; }
        public int G { get; private set; }
        public int B { get; private set; }

        public string ColorName { get; private set; }

        public DBColor(string name, int r, int g, int b)
        {
            this.ColorName = name;
            this.R = r;
            this.G = g;
            this.B = b;
        }

        public static DBColor FromRgb(int r, int g, int b)
        {
            return new DBColor("", r, g, b);
        }
        public override string ToString()
        {
            if (ColorName.Length > 0) return ColorName;

            else return string.Format("{0},{1},{2}", this.R, this.G, this.B);
        }
    }
}
